package com.xavier.dong.nio.zerocopy;

import java.io.DataInputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 *
 * 传统 id 的服务器端
 *
 * @author XavierDong
 **/
public class OldIOServer {


    public static void main(String[] args) {

        try {
            ServerSocket serverSocket = new ServerSocket(7001);

            while (true) {

                Socket socket = serverSocket.accept();

                DataInputStream dataInputStream = new DataInputStream(socket.getInputStream());

                byte[] bytes = new byte[1024];

                while (true) {

                    int readCount = dataInputStream.read(bytes, 0, bytes.length);

                    while (readCount == -1) {
                        break;
                    }

                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
